/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.put.dcs_modeler.visualModelEditor.actions.openSupport;

import java.util.logging.Logger;
import org.openide.cookies.CloseCookie;
import org.openide.cookies.OpenCookie;
import org.openide.loaders.OpenSupport;
import org.openide.windows.CloneableTopComponent;
import pl.put.dcs_modeler.fileTypeDataLoader.DCSComputingModelDataObject;
import pl.put.dcs_modeler.visualModelEditor.windowComponenets.CFMWindowTopComponent;

/**
 *
 * @author LukaszR
 */
public class DCSComputingObjectOpenSupport extends OpenSupport implements OpenCookie, CloseCookie 
{
    private static Logger log =
            Logger.getLogger( DCSComputingObjectOpenSupport.class.getName() );
    
    
    public DCSComputingObjectOpenSupport( DCSComputingModelDataObject.Entry entry ) 
    {
        super(entry);
    }
    
    @Override
    protected CloneableTopComponent createCloneableTopComponent() 
    {     
        DCSComputingModelDataObject dobj = ( DCSComputingModelDataObject )entry.getDataObject();

        CFMWindowTopComponent tc = CFMWindowTopComponent.findInstance( dobj );
        tc.setName( dobj.getPrimaryFile().getName() );
        tc.setDisplayName( dobj.getPrimaryFile().getName() );
        return tc;
    }

    

}
